﻿using System.ComponentModel.DataAnnotations;

namespace Infrastructure.DDD
{
    public class Entity : IEntity
    {
        [Key]
        public int Id { get; set; }
        public DateTime CreateTime { get; set; } = DateTime.Now;
        public DateTime UpdateTime { get; set; } = DateTime.Now;
        public bool IsDelete { get; set; } = false;
        public virtual void Delete()
        {
            IsDelete = true;
        }
        public virtual void UpdateTimeNow()
        {
            UpdateTime = DateTime.Now;
        }
    }
    public class EntityWithoutUpdateTime : IEntityWithoutUpdateTime
    {
        public int Id { get; set; }
        public DateTime CreateTime { get; set; } = DateTime.Now;
        public bool IsDelete { get; set; } = false;
        public virtual void Delete()
        {
            IsDelete = true;
        }
    }
}
